<template>

    <a-modal
        :bodyStyle="{maxHeight: maxHeight+'px', overflow: 'auto' }"
        :destroyOnClose="true"
        :title="title"
        :width="width"
        :visible="visible"
        :confirmLoading="confirmLoading"
        :maskClosable="true"
        @ok="ok"
        @cancel="cancel"
        v-drag
        cancelText="关闭"
        
        :ok-button-props="{ props: { shape:'round'} }"
        :cancel-button-props="{ props: { shape:'round'} }">
        
        
        <div class="table-page-search-wrapper">
           
            <LTable
                ref="selectPackage"
                size="middle"
                :rowKey="record=>record.keyId"
                :columns="columns"
                axiosUrl="/KhyPackageController/list"
                :initOrder="initOrder"
                :showPagination="false"
                :showQueryForm="true"
                :initQuery="initQuery"
                :rowSelection="{onChange: onSelectChange }"
            ></LTable>
        </div>
   

    </a-modal>



    
</template>

<script>
import LTable from '@/components/lt/LTable'
import {SysMixin} from '@/mixins/SysMixin'
import defaultSettings from '@/config/defaultSettings'

export default {
    name:'selectInventoryList',
    components:{LTable},
    mixins:[SysMixin],
    props:{
       
      
    },
    data(){
        return{
            defaultSettings,
            selectedRowKeys:[],
            selectedRows:[],
            initDictCodes:defaultSettings.数据字典.客运站下拉+','+defaultSettings.数据字典.快递状态下拉,
            maxHeight:800,
            width:document.documentElement.clientWidth-400,
            confirmLoading:false,
            visible:false,
            title:"快递单选择",
            initOrder:[{field:'orderTime',val:'desc'}],
            initQuery:[{field:'packageState',val:defaultSettings.常量.快递单状态_已下单}],
            columns:[
                {
                    title: '快递单号',
                    dataIndex: 'packageNo'
                },
                
                {
                    title: '发运站',
                    dataIndex: 'startStation',
                    customRender:(text)=>{
                        if(!text){
                            return ''
                        }else{
                            return this.dictText(defaultSettings.数据字典.客运站下拉,text)
                        }
                    }
                },
                {
                    title: '到达站',
                    dataIndex: 'endStation',
                    customRender:(text)=>{
                        if(!text){
                            return ''
                        }else{
                            return this.dictText(defaultSettings.数据字典.客运站下拉,text)
                        }
                    }
                },
                {
                    title: '托运人姓名',
                    dataIndex: 'senderName'
                },
                {
                    title: '收件人姓名',
                    dataIndex: 'consigneeName'
                },
                {
                    title: '托运人电话',
                    dataIndex: 'senderPhone'
                },
                {
                    title: '收件人电话',
                    dataIndex: 'consigneePhone'
                },
             
            ]
      
        }
    },
    created(){
       
    },
    computed:{
       
    },
    watch:{
        
    },
    methods:{
       
        edit (record) {
            
            this.visible = true
            this.selectedRecord={}

        },
        ok(){
            let that = this
            that.$emit('onAddPackage',this.selectedRows)
            that.close()
        
        },
        cancel(){
            this.visible=false
            this.$emit('handleCancel');
        },
        close () {
            this.$emit('close');
            this.visible = false;
        },
       
        getForm(){
            return this.$refs.LForm.form
        },
         onSelectChange (selectedRowKeys, selectedRows) {
            this.selectedRowKeys = selectedRowKeys
            this.selectedRows = selectedRows
        },
    }

}
</script>

<style lang="less" scoped>
    @import "../../../layouts/BasicLayout.less";
    ::v-deep .selectRowClass{
        background-color:var(--primary-color) !important;
    }
</style>